<script>
    function cx(f, c) {
        l = c.length
        sum = 0
        while (l-- != 0) {
            if (f == c[l])
                sum++
        }
        if (sum == 0)
            return false
        return sum
    }
    alert(cx('1', '101'))
</script>